home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Imagine the Universe (9th Edition)
/
Imagine the Universe 9 - Disc 1.iso
/
pc
/
imagine
/
docs
/
science
/
quiz_l1
/
js
/
multiwavelength.js
< prev
next >
Wrap
Text File
|
2002-12-30
|
2KB
|
63 lines
// Path needs to be relative link from page that called this script
Image1 = new Image();
Image1.src = "../../../Images/heasarc/icons/blank2.gif";
Image2 = new Image();
Image2.src = "../../../Images/heasarc/icons/star2.gif";
total = 3;
yourAnswer = new Array(total);
answer = new Array("B","D","A");
function Swap(start, end) {
for (i = start; i <= end; i++) {
document.images["correct" + i].src = Image2.src;
}
return true;
}
function AssignClick(letter, position) {
yourAnswer[position] = letter.value;
}
function CheckMe() {
var count = 0;
for (i = 0; i < total; i++) {
if (yourAnswer[i] == answer[i]) {count++;}
}
Swap(1, total);
var win = window.open("", "score_window", "width=300,height=300, resizable=yes,scrollbars=yes");
win.document.write('<HTML>\n<HEAD>\n<TITLE>Your Score</TITLE>\n</HEAD>\n');
win.document.write('<BODY BGCOLOR="#FFFFFF" TEXT="#000094" LINK="#7D5F00"'); win.document.write(' VLINK="#9E0A42" ALINK="#FF0000">');
win.document.write('<H2 ALIGN="CENTER">');
if (count == total) {
win.document.write('<P ALIGN="CENTER">\n');
win.document.write('<IMG SRC="../../../Images/icons/fireworks.gif" BORDER=0>\n');
win.document.write('</P>\n');
}
win.document.write ("Your score is " +
Math.round(count*100/total) + " %!\n</H2>\n</P><P>\n");
win.document.write("<CENTER>")
win.document.write("<FORM>");
win.document.write("<TABLE BORDER=5 CELLPADDING=10>");
win.document.write("<TR><TD ALIGN=\"CENTER\">");
win.document.write("<INPUT TYPE=button VALUE=\"Close\" onClick=\"window.close()\"></TD></TR>");
win.document.write("</TABLE>");
win.document.write("</FORM>");
win.document.write("</CENTER>");
if (count < total) {
win.document.write ("<CENTER>\n</P><P><P><BR><BR><BR>\n");
win.document.write ("Stars are next to the correct answers.</P><P>\n");
win.document.write ("</CENTER>\n");
}
win.document.write('</BODY>\n</HTML>\n');
}